#include "AacDecoder.hpp"
#include <iostream>

AacDecoder::AacDecoder() : fh(NULL), buffercount(0), buffer_index(0), bytes_in_buffer(0) {

}
AacDecoder::~AacDecoder() {
    close();
}

bool AacDecoder::load(const char* filename) {
    hDecoder=NeAACDecOpen();
    NeAACDecFrameInfo frameInfo;
    config=NeAACDecGetCurrentConfiguration(hDecoder);
    NeAACDecSetConfiguration(hDecoder, config);
    fh=fopen(filename, "rb");
    if(fh==NULL) {
        std::cout<<"Cannot open AAC file: "<<filename<<std::endl;
        return false;
    }
    INIT_BUFF(fh);
    return true;
}

void AacDecoder::close() {
    NeAACDecClose(hDecoder);
    fclose(fh);
}
#include <iostream>
int AacDecoder::decode(float* data, unsigned long frames, bool silence) {
    return -1;
}

bool AacDecoder::seek(unsigned int frame) {

    return true;
}

